﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/header.js"></script>
    <script src="/lib/date/wdatepicker.js"></script>
    
</head>
<body>
    <div class="data-wrap case">
        <form class="form-inline" id="formSearch">
            <div class="data-tool clearfix">
                <div class="pull-left form-inline ">
                    <a class="btn btn-default btn-sm" data-modal="/view/payment/paymentrecordAdd.html" data-title="新增" data-width="452" data-height="440"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                </div>
                <div class="pull-right">


                    <input type="hidden" name="companyId" />

                    <div class="input-group input-group-sm">
                        <div class="input-sm"><input name="autoRefresh" type="checkbox" title="10秒自动刷新" /> <label id="time" class="wd100">10秒自动刷新</label></div>
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">公司名称：</label>
                        <input class="form-control" name="companyName" type="text" autocomplete="off">
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">订单号：</label>
                        <input class="form-control" name="orderNo" type="text" autocomplete="off">
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">创建时间：</label>
                        <input id="d421" class="Wdate wd125" name="startTime" type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" autocomplete="off" />
                        --<input id="d422" class="Wdate wd125 m5_l" name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d421\')}'})" autocomplete="off" />
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">付款结果：</label>
                        <select class="form-control" name="paymentStatus">
                            <option value="">请选择</option>
                            <option value="1">未付款</option>
                            <option value="2">付款成功</option>
                            <option value="3">付款失败</option>
                            <option value="4">付款中</option>
                            <option value="5">取消付款</option>
                            <option value="6">异常</option>
                        </select>
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">通知状态：</label>
                        <select class="form-control" name="noticeStatus">
                            <option value="">请选择</option>
                            <option value="1">未通知</option>
                            <option value="2">通知成功</option>
                            <option value="3">通知失败</option>
                            <option value="4">通知中</option>
                        </select>
                    </div>

                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                    <button type="button" class="btn btn-default btn-sm" id="AdvSearch">高级搜索</button>

                </div>
            </div>

            <!--一高级搜索开始-->
            <div class="AdvSearch">
                <div class="AdvSearchcom collapse">
                    <table>
                        <tbody>
                            <tr>
                                <td>客户姓名：</td>
                                <td><input class="form-control" name="withdrawalAccountName" type="text" autocomplete="off"></td>
                                <td>客户卡号：</td>
                                <td><input class="form-control" name="withdrawalCardNumber" type="text" autocomplete="off"></td>
                            </tr>
                            <tr>
                                <td>付款名称：</td>
                                <td><input class="form-control" name="cardName" type="text" autocomplete="off"></td>
                            </tr>
                            
                        </tbody>
                    </table>
                    <div class="AdvSearchfooter t_c">
                        <button id="search" class="btn btn-default btn-sm" type="button">立即搜索</button>
                        <button id="cancel" data-dismiss="modal" class="btn btn-default btn-sm" type="button">取消</button>
                    </div>
                </div>
            </div>
        </form>
        <!--高级搜索结束-->
        <div class="paging">
        </div>
    </div>

    <script type="text/x-dot-template" id="pgerTemplate">
        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l wd150">订单号</th>
                                <th class="t_l wd100">公司名称</th>
                                <th class="t_l wd200">客户单号</th>
                                <th class="t_l wd75">银行名称</th>
                                <th class="t_l wd75">付款姓名</th>
                                <th class="t_l wd125">付款卡号</th>
                                <th class="t_r wd75">付款金额</th>

                                <th class="wd130">付款时间</th>
                                <th class="t_l wd200">付款结果</th>
                                <th class="t_l wd125">通知状态</th>

                                <th class="wd130">通知时间</th>
                                <th class="wd75">通知次数</th>

                                <th class="t_l wd75">客户姓名</th>
                                <th class="t_l wd175">客户银行</th>
                                <th class="t_l wd150">客户卡号</th>
                                <th class="wd130">创建时间</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l wd150" title="{{= item.orderNo }}">{{= item.orderNo }}</td>
                                <td class="t_l wd100" title="{{= item.companyNameEn }}">{{= item.companyName }}</td>
                                <td class="t_l wd200" title="{{= item.withdrawalOrderNo }}">{{= item.withdrawalOrderNo }}</td>
                                <td class="t_l wd75">{{= item.bankName }}</td>
                                <td class="t_l wd75" title="{{= item.cardName }}">{{= item.cardName }}</td>
                                <td class="t_l wd125" title="{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}">{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}</td>
                                <td class="t_r bold wd75">{{= item.withdrawalAmount }}</td>
                                <td class="wd130">
                                    {{? item.paymentStatus==3 || item.paymentStatus==4 }}
                                    {{= FlashPay.Util.FormatDate(item.readDate) }}
                                    {{?? }}
                                    {{= FlashPay.Util.FormatDate(item.paymentDate) }}
                                    {{? }}

                                </td>
                                <td class="t_l wd200">
                                    {{?  item.paymentStatus}}

                                    {{? item.paymentStatus==1 }}
                                        <span class='bold'>未付款</span>
                                        <a class="btn btn-danger btn-xs" data-confirm='"{{= item.orderNo }}" <br>确定要<span class="red">取消</span>该付款单？' data-href="/Payment/PaymentRecordCancel?orderNo={{= item.orderNo}}">取消</a>
                                        {{? item.confirmStatus==1 }}<a class="btn btn-primary btn-xs" data-modal="/view/payment/paymentconfirm.html?orderNo={{= item.orderNo}}" data-title="确认付款" data-confirmname="确认付款" data-width="400" data-height="175"> 付款审核</a>{{? }}
                                    {{?? item.paymentStatus==2}}
                                        <span class='green bold'>付款成功</span>
                                    {{?? item.paymentStatus==3}}
                                        <span class='red bold'>付款失败</span>
                                    {{?? item.paymentStatus==4}}
                                        <span class='bold'>付款中</span>
                                        {{? item.timeDifference>20 }}<a class="btn btn-default btn-xs" onclick="return view(this)" data-href="/view/payment/paymentrecordreals.html?orderNo={{= item.orderNo}}" data-title="{{= item.orderNo }}-查询" data-width="900" data-height="300">查询</a>{{? }}
                                    {{?? }}
                                        <span class='bold'>取消付款</span>
                                    {{? }}


                                    {{??}}

                                    {{?}}

                                </td>{{? item.noticeStatus==1 }}{{? }}
                                <td class="t_l wd125">
                                    {{? item.noticeStatus==1 }}
                                        <span class='bold'>未通知</span>
                                    {{?? item.noticeStatus==2}}
                                        <span class='green bold'>通知成功</span>
                                    {{?? item.noticeStatus==3}}
                                        <span class='red bold'>通知失败</span> {{? item.noticeTimes==5 }}<a class="btn btn-default btn-primary btn-xs" data-confirm='"{{= item.orderNo }}" <br>确定要<span class="red">重置</span>该付款单？' data-href="/Payment/PaymentRecordReset?orderNo={{= item.orderNo}}">重置</a>{{?}}
                                    {{?? }}
                                        <span class='bold'>通知中</span>
                                    {{? }}
                                </td>

                                <td class="wd130">
                                    {{?  item.noticeLastDate}}{{= FlashPay.Util.FormatDate(item.noticeLastDate)}}{{??}}{{?}}
                                </td>
                                <td class="wd75">
                                    {{?  item.noticeTimes}}{{= item.noticeTimes }}{{??}}0{{?}}
                                </td>

                                <td class="t_l wd75" title="{{= item.withdrawalAccountName }}">{{= item.withdrawalAccountName }}</td>
                                <td class="t_l wd175" title="{{= item.withdrawalBankName }}">{{= item.withdrawalBankName }}</td>
                                <td class="t_l wd150" title="{{= FlashPay.Util.SubCardNumber(item.withdrawalCardNumber) }}">{{= FlashPay.Util.SubCardNumber(item.withdrawalCardNumber) }}</td>

                                <td class="wd130">{{= FlashPay.Util.FormatDate(item.createDbdate) }}</td>

                            </tr>
                            {{~}}
                            {{??}}
                            <tr class="noRecord">
                                <td colspan="16">暂无记录！</td>
                            </tr>
                            {{?}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    <script type="text/javascript">

        var wait = 10;

        var autoRefresh = $("input[name='autoRefresh']");

        $(function () {
            $("input[name='startTime']").val(FlashPay.Util.GetDateStr(-1));
            $("input[name='endTime']").val(FlashPay.Util.GetDateStr(0));

            FlashPay.UI.DataAutoHeight();

            FlashPay.UI.Triggerbox({
                btnAdvSearch: '#AdvSearch',
                searchCallBack: function () {
                    window.currentPage = null;
                    doSearch();
                },
                cancelCallBack: function () {

                }
            });

            $("#btnSearch").click(function () {
                window.currentPage = null;

                doSearch();
            });

            $(autoRefresh).change(function () {
                wait = 10;
                time();
            });

            FlashPay.UI.DoSearch();

        });

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                FlashPay.UI.DoSearch();
            }
        });

        //倒时计
        function time() {
            var obj = document.getElementById("time");

            var isauto = $(autoRefresh).is(':checked');
            if (!isauto) {

                obj.innerText = "10秒自动刷新";

                return false;
            }

            if (wait == 0) {
                obj.innerText = "10秒自动刷新";
                wait = 10;

                if (isauto) {
                    setTimeout(function () { time(); }, 1000);
                }

                FlashPay.UI.DoSearch();
            } else {
                obj.innerText = wait + "秒自动刷新";
                wait--;
                setTimeout(function () { time(); }, 1000);
            }
        }

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function doSearch() {
            FlashPay.UI.Pager(".paging", { templateId: "pgerTemplate", pageSize: 15, ajax: { url: '/Payment/PaymentRecord'} });
        }

        //添加同级节点
        function view(obj) {
            eval(function (p, a, c, k, e, r) { e = String; if (!''.replace(/^/, String)) { while (c--) r[c] = k[c] || c; k = [function (e) { return r[e] }]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('5.6.7($(0).1("8"),{2:$(0).1("2"),3:$(0).1("3"),4:$(0).1("4")});', 9, 9, 'obj|data|title|width|height|FlashPay|UI|DialogOpen|href'.split('|'), 0, {}))
        }
    </script>
</body>
</html>